package com.moyu.user.controller;

import com.moyu.common.core.contants.HttpConstants;
import com.moyu.common.core.controller.BaseController;
import com.moyu.common.core.domain.BaseEntity;
import com.moyu.common.core.domain.R;
import com.moyu.user.domain.feedback.FeedBack;
import com.moyu.user.domain.feedback.dto.FeedBackInsertDTO;
import com.moyu.user.domain.feedback.dto.FeedBackQueryDTO;
import com.moyu.user.domain.feedback.dto.FeedBackUpdateDTO;
import com.moyu.user.domain.feedback.vo.FeedBackVO;
import com.moyu.user.service.IFeedBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 反馈控制器
 *
 * @Author  赵彦博
 * @Date 2025/4/19
 */
@RestController
@RequestMapping("/feedback")
public class FeedBackController extends BaseController {

    @Autowired
    private IFeedBackService feedBackService;

    @PostMapping("/createFeedBack")
    public R createFeedBack(@RequestHeader(HttpConstants.AUTHENTICATION) String token,@RequestBody FeedBackInsertDTO feedBackInsertDTO) {
        return toR(feedBackService.createFeedBack(token,feedBackInsertDTO));
    }

    @GetMapping("/list")
    public List<FeedBackVO> list(@ModelAttribute  FeedBackQueryDTO feedBackQueryDTO) {
        return feedBackService.list(feedBackQueryDTO);
    }

    @PostMapping("/process")
    public R process(@RequestBody FeedBackUpdateDTO feedBackUpdateDTO) {
        return toR(feedBackService.process(feedBackUpdateDTO));
    }
}
